﻿

@{
    Layout = "";
}
<style>
    .ngdialog.ngdialog-theme-plain .ngdialog-content {
        width: 25% !important;
    }
</style>
<div ng-controller="PayListController">
    <h3>充值记录</h3>

    <div class="panel panel-default" ng-class="{ 'whirl standard': isLoading}">
        <div class="panel-heading">
            <div class="form-inline ng-pristine ng-valid">
                <div class="form-group">
                    <input id="input-email" placeholder="会员昵称" class="form-control" type="text" ng-model="Keywords">
                    <p class="input-group" style="margin-top:10px">
                        <input placeholder="开始时间" datetime-picker="yyyy-MM-dd HH:mm:ss" is-open="picker1.open" datepicker-options="datepickerOptions" class="form-control" type="text" ng-model="BeginTime">
                        <span class="input-group-btn">
                            <button type="button" class="btn btn-default" ng-click="openCalendar($event, 'picker1')"><i class="fa fa-calendar"></i></button>
                        </span>
                    </p>
                    <p class="input-group" style="margin-top:10px">
                        <input placeholder="结束时间" datetime-picker="yyyy-MM-dd HH:mm:ss" is-open="picker2.open" datepicker-options="datepickerOptions" class="form-control" type="text" ng-model="EndTime">
                        <span class="input-group-btn">
                            <button type="button" class="btn btn-default" ng-click="openCalendar($event, 'picker2')"><i class="fa fa-calendar"></i></button>
                        </span>
                    </p>
                    <button type="submit" class="btn btn-labeled btn-primary" ng-click="tableParams.$params.page = 1;tableParams.reload()">
                        <span class="btn-label">
                            <em class="fa fa-search"></em>
                        </span>搜索
                    </button>
                </div>
                @*<div class="form-group">
                        <button type="submit" class="btn btn-labeled btn-success" ng-click="positionManagementUpdataView(0)">
                            <span class="btn-label">
                                <em class="fa fa-plus"></em>
                            </span>新增
                        </button>
                    </div>*@
            </div>
        </div>
        <div class="panel-body">
            <div class="table-responsive">
                <table ng-table="tableParams" class="table table-striped table-bproducted table-hover">
                    <tbody>
                        <tr ng-repeat="item in $data">
                            <td data-title="'会员Id'" class="text-center">{{item.MemberId}}</td>
                            <td data-title="'会员昵称'" class="text-center">{{item.NickName}}</td>
                            <td data-title="'充值金额'" class="text-center">{{item.Amount}}</td>
                            <td data-title="'充值时间'" class="text-center">{{item.PayTime}}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script>
    App.controller('PayListController', [
    '$scope', '$resource', '$state', '$route', '$http', 'ngTableParams', 'ngTableDataService', 'Notify', '$filter', 'ngDialog', "$stateParams", "$timeout", "toaster",
        function ($scope, $resource, $state, $route, $http, ngTableParams, ngTableDataService, Notify, $filter, ngDialog, $stateParams, $timeout, toaster) {
            'use strict';
            $scope.isLoading = true;


            // 日期插件
            $scope.picker1 = {
                date: new Date()
            };

            $scope.picker2 = {
                date: new Date()
            };

            $scope.datepickerOptions = {
                showWeeks: false,
                startingDay: 1,
                dateDisabled: function (data) {
                    //return (data.mode === 'day' && (new Date().toDateString() == data.date.toDateString()));
                }
            }

            $scope.openCalendar = function (e, picker) {
                $scope[picker].open = true;
            };


            //数据查询
            $scope.tableParams = new ngTableParams({
                page: 1,
                count: 10,
                sorting: {
                    Id: 'desc'     // 初始化排序
                }
            }, {
                getData: function ($defer, params) {
                    $scope.isLoading = true;
                    var requestParams = {
                        Skip: (params.page() - 1) * params.count(),
                        Take: params.count(),
                        KeyWord: $scope.Keywords,
                        BeginTime: $scope.BeginTime,
                        EndTime: $scope.EndTime,
                    };
                    $http.post('/Member/GetPayList', ngTableDataService.getServerSideParams(params.orderBy().toString(), params, requestParams))
                        .success(function (data, status) {
                            console.log(data);
                            params.total(data.count);
                            $defer.resolve(data.data);
                            $scope.isLoading = false;
                        });
                }
            });



        }
    ]);
</script>
